<template>
  <div class="page result pay-result">
    <div class="scroll-view">
      <customHeader middleTitle="支付结果">
      </customHeader>
      <div class="page-body">
        <result type="success" title="支付成功" v-if="typeResult=='true'"  :msg="msg"/>
        <result type="false" title="支付失败" v-if="typeResult=='false'"   :msg="msg"/>
        <ul class="result-btn">
          <li @click="checkOrder">查看订单</li>
          <li @click="continueOrder">继续选购</li>
        </ul>
        <div class="btn-wrap" v-if="machineType==33" @click="linkToAdd">
          <div class="btn">创建活动</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import customHeader from "../../components/header/header";

import result from "../../components/result/result";

export default {
  name: "payResult",
  data() {
    return {
      msg:"",
      typeResult: "",
      toRouterNum: "",
      toRouterRecordNum: "", 
      machineType:"",
    };
  },
  methods: {
    checkOrder() {
      //toRouterRecordNum判断来源页 1：商品详情  2.订购记录  3.订单详情
      if (this.toRouterRecordNum == 1) {
        this.$router.push({ path: "/mallList/orderRecord" });
      } else if (this.toRouterRecordNum == 2) {
        this.$router.go(-1);
      } else if (this.toRouterRecordNum == 3) {
        this.$router.go(-2);
      }
    },
    continueOrder() {
      // //toRouterNum判断来源页 1：商品详情  订购记录  3.订单详情
      // this.toRouterNum == 1 ? this.$router.go(-2) : this.$router.go(-3);
      this.$router.push({ path: "/mallList",query:{close:'true'} });
    },
    linkToAdd(){
      this.$router.push({ path: "/pettySavings",query:{close:'true'} });
    }
  },
  created() {
    this.typeResult = this.$route.query.type;
    this.toRouterNum = this.$route.query.toRouterNum;
    this.toRouterRecordNum = this.$route.query.toRouterRecordNum;
    this.machineType = this.$route.query.machineType;
    this.msg = this.$route.query.msg;
  },
  components: {
    customHeader,
    result
  }
};
</script>

<style lang='scss' scoped>
@import "mall";
</style>
